<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/1/24 0024
 * Time: 18:22
 */
//[1,2,3,7,8,"hello",[1,2,4]]
//{"h":"hello","w":"world",[1,2,3]}

//encode >>>>>>>>>>>>>>>>>编码
//$arr = array(1,2,5,'hello','world',array('h'=>'hello','w'=>'world'));
//print_r($arr);
//echo json_encode($arr);//将数组转为json格式 [1,2,5,"hello","world",{"h":"hello","w":"world"}]

//$obj =array('h'=>'hello','w'=>'world',array(1,3,2));

//deconde解码
$jsonstr='[1,2,5,"hello","world",{"h":"hello","w":"world"}]';
$obj = json_decode($jsonstr);
print_r($obj);//打印全部
//echo $obj->h;